﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace nr.GLV.Windows
{
    public partial class MailTemplateChoiceForm : Form
    {
        public string TemplateName { get { return txtFileName.Text; } set { txtFileName.Text = value; } }
        public string SelectedPrinter { get { return cbPrinterSelector.SelectedPrinter; } set { cbPrinterSelector.SelectedPrinter = value; } }

        public MailTemplateChoiceForm()
        {
            InitializeComponent();
        }

        private void txtFileName_TextChanged(object sender, EventArgs e)
        {
            bool isEnabled = System.IO.File.Exists(txtFileName.Text);
            btnPreview.Enabled = isEnabled;
            btnPrint.Enabled = isEnabled;
        }

        private void btnBrowse_Click(object sender, EventArgs e)
        {
            if (dlgOpen.ShowDialog(this) == System.Windows.Forms.DialogResult.OK)
            {
                txtFileName.Text = dlgOpen.FileName;
                txtFileName.SelectionStart = txtFileName.Text.Length;
            }
        }
    }
}
